package com.platform.module.common.redis;

import com.platform.module.common.utils.FileLoad;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 读取lua脚本服务类
 */
@Service
@AllArgsConstructor
public class RedisLuaService {
    private final CacheClient cacheClient;
    private static String testRequestNum;

    static {
        RedisLuaService.testRequestNum = FileLoad.read("lua/test_request_num.lua");
    }

    public Boolean testRequestNum(String... key) {
        return cacheClient.executeLuaScript(testRequestNum, List.of(key));
    }
}
